<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <input type="file" id="box">
</body>
</html>
<!-- <script src="b.js"></script> -->
<script>
    document.getElementById('box').onchange = function(e) {
        console.log(e.target.files);

        var file = e.target.files[0];
        r = new FileReader();  //本地预览
        r.onload = function(){
            console.log(r.result);
        }
        r.readAsDataURL(file); 
    };



</script>